Property Grid Object Model

The main class you will work with is the PropertyGrid class. This represents the control itself. However, you will also need to understand editors, and for dynamic population of the grid you will need to understand nodes.

About Editors

An editor is an object that provides a value editing service for the property grid. Editors are responsible for populating the right-hand column of the grid, where the user can view and edit values. The property grid provides a number of built-in editors, which allow users to edit strings, numeric values, dates and enumerated types. You will need to know about editors if you want to:

The types of editor you will normally work with are type editors and property editors.

If a property editor doesn’t specify a declaring type, it will edit any grid entry with a matching property name or label. This is useful if you are using the ItemsSource property to bind the grid to a collection of values, and want to use custom editors for some of those values.
 

Although an editor normally allows users to modify the value, it is not required to do so. In fact, an editor works by providing a data template, which the property grid uses to render the property value. For an editor to allow users to modify the value simply means that the template allows user input and uses two-way binding to propagate changes back to the source; conversely, you can use the editor model to display values as read-only by creating a data template which does not allow user input.

About Nodes

A node is an entry in the property grid. When the grid automatically populates because the SelectedObject or ItemsSource property has been set, you do not need to work with nodes. However, if you manage the contents of the grid directly from code using the AddNode and RemoveNode methods, you may need to know something about nodes.

When you add an item to the grid using AddNode, the grid returns the resulting Node object to you. You can use this object for two things:

You don’t need to create Node objects yourself.